package com.ys.bean.factory;

import com.ys.exception.BeansException;

import java.util.Map;

/**
 * <p>@description:</p>
 *
 * @projectName: Spring-Mini
 * @packageName: com.com.ys.bean.factory
 * @className:
 * @author: shuangyang
 * @date: 1/15/17 9:16 PM
 */
public interface ListableBeanFactory extends BeanFactory{
    /**
     * Check if this bean factory contains a bean definition with the given name.
     * @param beanName the name of the bean to look for
     * @return if this bean factory contains a bean definition with the given name
     */
    boolean containsBeanDefinition(String beanName);

    /**
     * Return the number of beans defined in the factory.
     * other means than bean definitions.
     * @return the number of beans defined in the factory
     */
    int getBeanDefinitionCount();

    /**
     * Return the names of all beans defined in this factory.
     * @return the names of all beans defined in this factory,
     * or an empty array if none defined
     */
    String[] getBeanDefinitionNames();

    /**
     * Return the names of beans matching the given type (including subclasses),

     * @param type the class or interface to match, or <code>null</code> for all bean names
     * @return the names of beans (or objects created by FactoryBeans) matching
     * the given object type (including subclasses), or an empty array if none
     */
    String[] getBeanNamesForType(Class<?> type);


    /**
     * Return the bean instances that match the given object type (including
     * subclasses)
     * @param type the class or interface to match, or <code>null</code> for all concrete beans
     * @return a Map with the matching beans, containing the bean names as
     * keys and the corresponding bean instances as values
     * @throws BeansException if a bean could not be created
          */
    <T> Map<String, T> getBeansOfType(Class<T> type) throws BeansException;




}
